﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

using Com.Framework;
using Com.Framework.Data;
using Com.Library.DB.Menu;
using Com.Web.coffinegurunaru.AppLogic.Page;

namespace Com.Web.coffinegurunaru.menu
{
	public partial class menu_view : WebPage
	{
		public string[] CategoryImage = { ""
											, "/images/menu/tit_03_1.gif", "/images/menu/tit_03_1.gif"		// blended
											, "/images/menu/tit_03_2.gif", "/images/menu/tit_03_2.gif"		// espresso
											, "/images/menu/tit_03_3.gif", "/images/menu/tit_03_3.gif"		// chocolate
											, "/images/menu/tit_03_4.gif"									// wine
											, "/images/menu/tit_04.gif"										// tea
											, "/images/menu/tit_05_1.gif"									// bread
											, "/images/menu/tit_05_2.gif"									// sandwich
										};
		public int CategoryNo = 0;
		public int SeqNo = 0;
		public int PageNo = 0;
		public int PageNo1 = 0;
		public int PageNo2 = 0;

		public MenuEntity MenuInfo
		{
			get;
			set;
		}

		protected void Page_Load(object sender, EventArgs e)
		{
			CategoryNo = Request.QueryString["CategoryNo"].Parse(0);
			SeqNo = Request.QueryString["SeqNo"].Parse(0);
			PageNo = Request.QueryString["v"].Parse(0);
			PageNo1 = Request.QueryString["PageNo1"].Parse(0);
			PageNo2 = Request.QueryString["PageNo2"].Parse(0);

			try
			{
				MenuInfo = MenuModel.GetInfo(SeqNo);
			}
			catch
			{
				Response.Clear();
				Response.Write("<script language='javascript'>history.go(-1);</script>");
			}
		}

		public string GetListURL()
		{
			string PageURL = "/menu/";
			string QueryString = "";

			if (CategoryNo == 1)
				PageURL += "drink_blended.aspx";
			if (CategoryNo == 2)
				PageURL += "drink_blended.aspx";
			if (CategoryNo == 3)
				PageURL += "drink_blended.aspx";
			if (CategoryNo == 4)
				PageURL += "drink_blended.aspx";
			if (CategoryNo == 5)
				PageURL += "drink_chocolate.aspx";
			if (CategoryNo == 6)
				PageURL += "drink_chocolate.aspx";
			if (CategoryNo == 7)
				PageURL += "drink_tea.aspx";
			if (CategoryNo == 8)
				PageURL += "wine.aspx";
			if (CategoryNo == 9)
				PageURL += "dessert_bread.aspx";
			if (CategoryNo == 10)
				PageURL += "dessert_sandwich.aspx";

			if (PageNo != 0)
				QueryString += (QueryString == "" ? "?" : "&") + "PageNo=" + PageNo.ToString();
			if (PageNo1 != 0)
				QueryString += (QueryString == "" ? "?" : "&") + "PageNo1=" + PageNo1.ToString();
			if (PageNo2 != 0)
				QueryString += (QueryString == "" ? "?" : "&") + "PageNo2=" + PageNo2.ToString();

			return PageURL + QueryString;
			
		}
	}
}
